using System;
using System.BusinessObjects.Transactions;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using Blazing.BusinessObjects.Tagging;

#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
   using NUnit.Framework;
   using TestClass = NUnit.Framework.TestFixtureAttribute;
   using TestMethod = NUnit.Framework.TestAttribute;
   using TestInitialize = NUnit.Framework.SetUpAttribute;
   using TestCleanup = NUnit.Framework.TearDownAttribute;
   using ClassInitialize = NUnit.Framework.TestFixtureSetUpAttribute;
   using ClassCleanup = NUnit.Framework.TestFixtureTearDownAttribute;
#endif

namespace BusinessObjectTests
{
    [TestClass]
    public class TagTests : NHibernateInMemoryTestFixtureBase
    {
        [TestMethod]
        public void CanLoadTag()
        {
            Tag tag = BusinessObjectFactory.CreateAndFillTag();
            tag.Save();

            int id = tag.ID;

            ITransaction trans = session.BeginTransaction();
            Tag tag2 = Tag.Load(id);
            Assert.AreEqual(tag.Name, tag2.Name);
            Assert.AreEqual(tag.Slug, tag2.Slug);
            trans.Commit();
        }
    }
}
